package com.pan.games.leecode;

/**
 * @author by panstark
 * @description
 * @notice
 * @date 2021/4/8
 */
public class MinGame {

    public int findMin(int[] nums) {

        if(nums.length==1){
            return nums[0];
        }

        for (int i = 0; i < nums.length-1; i++) {

            if(nums[i+1]<nums[i]){
                return nums[i+1];
            }
            if(i==nums.length-2){

                return Math.min(nums[0],nums[nums.length-1]);
            }
        }

        return 0;

    }
}
